<?php
	include('./fullrss.php');

	define('MAX_ITEMS',50);
	define('MAX_FETCH',30);

	$url='http://jandan.net/feed';
	$initData="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<rss version=\"2.0\">\r\n<channel>\r\n<title>煎蛋</title>\r\n<link>http://jandan.net</link>\r\n<description>地球上没有新鲜事</description>\r\n<pubDate>Tue, 13 Apr 2010 08:49:32 +0000</pubDate>\r\n<generator>http://wordpress.org/?v=mars</generator>\r\n<language>en</language>\r\n</channel>\r\n</rss>\r\n";
	$cacheDir='./cache';
	$cacheFile='jandan.xml';
	$lockFile='jandan.lock';
	
	ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');

	$feed=new FullRSS($url, $initData, $cacheDir, $cacheFile, $lockFile);
	$feed->GetFullRSS();

	function GetItem($link)
	{
		//$page = file_get_html($link);
		//$div=$page->find('div[class="post f"]',0);
		//$content=str_get_html($div->innertext);
		if($content = file_get_contents($link))
			if($content != '')
			{
				$description=explode('<!-- endpost -->',$content);
				if($description[0] != '')
				{
					$description=explode('<!-- beginpost -->',$description[0]);
					if(array_key_exists(1, $description))
						return $description[1];
					else
						return $description[0];
				}
			}
		return '';
	}
?>
